package com.imooc.ribbon.config;

import com.imooc.ribbon.rules.MyRule;
import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 注解方式配置ribbon负载均衡策略：@RibbonClient(name = "eureka-client",configuration = com.netflix.loadbalancer.RandomRule.class)
 * *        优先级高于配置文件中配置的负载均衡策略
 * @desc
 * @author zkw
 * @date 2021-03-27
 */
@Configuration
@RibbonClient(name = "eureka-client",configuration = MyRule.class)
public class RibbonConfiguration {

    // @Bean
    // public IRule defaultLbStrategy() {
    //     return new RandomRule();
    // }


}
